﻿using System;
using System.Collections.Generic;
using System.Drawing.Drawing2D;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ReprojectWebMercator
{
    /*
    debugger at   Scene.js  L 2592

    window.au=commands[0].derivedCommands.logDepth.command.shaderProgram.allUniforms;
    window.str="";
    for(let name in au){
        let aui=au[name];
        if(aui.value instanceof Texture){continue;}
        if(aui.value instanceof Cartesian2){
            //console.log("vec2 "+name+" = new vec2("+aui.value+")")
            str+="\r"+"public vec2 "+name+" = new vec2"+aui.value+";";
        }else if(aui.value instanceof Cartesian3){
            //console.log("vec3 "+name+" = new vec3("+aui.value+")")
             str+="\r"+"public vec3 "+name+" = new vec3"+aui.value+";";
        }else if(aui.value instanceof Cartesian4){
            //console.log("vec4 "+name+" = new vec4("+aui.value+")")
             str+="\r"+"public vec4 "+name+" = new vec4"+aui.value+";";
        }else if(aui.value instanceof Matrix4){
            //console.log("Matrix "+name+" = new Matrix"+aui.value.toString().replaceAll(")\n(",",")+")")
             str+="\r"+"public Matrix "+name+" = Matrix.FromColumns"+aui.value.toString().replaceAll(")\n(",",")+";"
        }else{
            //console.log("float "+name+" = (float)"+aui.value+"")
            str+="\r"+"public float "+name+" = (float)"+aui.value+";";
        }
    }
    str+="\rpublic vec2 viewport=vec2("+scene.view.viewport.width+","+scene.view.viewport.height+");";
    console.log(str);
    */
    public partial class CesiumGLSL : GLSLFuncBase
    {
        /*public Matrix czm_projection = 
            new Matrix("{0: 1.7320508075688772, 1: 0, 2: 0, 3: 0, 4: 0, 5: 3.5450385687624686, 6: 0, 7: 0, 8: 0, 9: 0, 10: -1.939930812737391, 11: -1, 12: 0, 13: 0, 14: -27091.98170479833, 15: 0}");
        public Matrix czm_viewportTransformation =
            new Matrix("{0: 876, 1: 0, 2: 0, 3: 0, 4: 0, 5: 428, 6: 0, 7: 0, 8: 0, 9: 0, 10: 0.5, 11: 0, 12: 876, 13: 428, 14: 0.5, 15: 1}");
        public vec2 czm_currentFrustum = new vec2("{x: 9215.1766250488, y: 28823.378633473527}");
        public float czm_pixelRatio =1.0f;
        public Matrix czm_modelViewRelativeToEye = 
            new Matrix(" {0: -0.9199541926188769, 1: -0.14654551705774896, 2: -0.36360513598301597, 3: 0, 4: -0.39202587093577196, 5: 0.3438935356612346, 6: 0.8532601904738466, 7: 0, 8: 1.387778780781446e-16, 9: 0.927502909731658, 10: -0.3738159339023786, 11: 0, 12: 0, 13: 0, 14: 0, 15: 1}");
        public vec3 czm_encodedCameraPositionMCHigh = new vec3("{x: -2293760, y: 5373952, z: 2424832}");
        public vec3 czm_encodedCameraPositionMCLow = new vec3(" {x: -14820.68111819867, y: 43518.20808642171, z: 50100.82848639134}");
        public Matrix czm_viewportOrthographic = new Matrix("{0: 0.001141552511415525, 1: 0, 2: 0, 3: 0, 4: 0, 5: 0.002336448598130841, 6: 0, 7: 0, 8: 0, 9: 0, 10: -2, 11: 0, 12: -1, 13: -0.9999999999999999, 14: -1, 15: 1}");
        */
        public vec2 czm_currentFrustum = new vec2(11738.496292332664, 30314.898027274627);
        public vec3 czm_encodedCameraPositionMCLow = new vec3(-61831.65895279404, 57638.682792373, 36323.91861970583);
        public vec3 czm_encodedCameraPositionMCHigh = new vec3(-2228224, 5373952, 2424832);
        public Matrix czm_viewportTransformation = Matrix.FromColumns(880.5, 0, 0, 880.5, 0, 430.5, 0, 430.5, 0, 0, 0.5, 0.5, 0, 0, 0, 1);
        public Matrix czm_projection = Matrix.FromColumns(1.7320508075688774, 0, 0, 0, 0, 3.545038568762469, 0, 0, 0, 0, -2.2638073249947768, -38312.19018333937, 0, 0, -1, 0);
        public vec2 czm_eyeHeight2D = new vec2(0, 0);
        public float czm_sceneMode = (float)3;
        public float czm_morphTime = (float)1;
        public Matrix czm_viewportOrthographic = Matrix.FromColumns(0.001135718341851221, 0, 0, -1, 0, 0.0023228803716608595, 0, -1, 0, 0, -2, -1, 0, 0, 0, 1);
        public Matrix czm_modelViewRelativeToEye = Matrix.FromColumns(-0.9214489947951452, -0.3884993564872617, -1.0685896612017132e-15, 0, -0.14606943772721626, 0.34644983142577657, 0.9266262642873372, 0, -0.3599937073798252, 0.8538388397783472, -0.37598373147370995, 0, 0, 0, 0, 1);
        public float czm_pixelRatio = (float)1;
        public vec4 batchTextureStep = new vec4(0.1111111111111111, 0.05555555555555555, 1, 0.5);
        public float czm_oneOverLog2FarDepthFromNearPlusOne = (float)0.07051559037640769;
        public float czm_farDepthFromNearPlusOne = (float)18577.401734941963;
        public vec2 viewport = vec2(1752, 856);
    }
}
